import codecs
import re
import pandas as pd
from os.path import join
import os
DATA_DIR = '../output/robertoutput/data_out/'
ResultDataPath = join(DATA_DIR,'test_results.tsv')
TestDataPath = join('./','Test_Data.csv')
pd_all = pd.read_csv(ResultDataPath ,sep='\t',header=None)
data = pd.DataFrame(columns=['negative'])

for index in pd_all.index:
    notnegative = pd_all.loc[index].values[0]
    negative = pd_all.loc[index].values[1]
    if max(notnegative,negative) ==notnegative:
        data.loc[index+1] = ["0"]
    else:
        data.loc[index+1] = ["1"]
df = pd.read_csv(TestDataPath)
df.index = df.index+1
print(df.head())
df["negative"] = data.loc[:,"negative"]
df = df.loc[:,["id","negative"]]
df.to_csv("./negative_result.csv",index=False)

